// Pipeline Component Library Example
// ----------------------------------
// Colin Bowern (colinbowern@hotmail.com)
// January 2007
//
// Copyright (c) 2007 Colin Bowern
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// * The above copyright notice and this permission notice shall be included in
//   all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#region References
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
#endregion

namespace RockstarGuys.PipelineComponents
{
    /// <summary>
    /// Regular Expression Object Collection
    /// </summary>
    public static class RegularExpressionObjects
    {
        #region Properties
        /// <summary>
        /// Gets the GUID format.
        /// </summary>
        /// <value>The GUID format.</value>
        public static Regex GuidFormat
        {
            get
            {
                
                Regex instance = HttpRuntime.Cache["GuidFormat"] as Regex;
                if (instance == null)
                {
                    instance = new Regex("^[A-Fa-f0-9]{32}$|({|\\()?[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}(}|\\))?$|^({)?[0xA-Fa-f0-9]{3,10}(, {0,1}[0xA-Fa-f0-9]{3,6}){2}, {0,1}({)([0xA-Fa-f0-9]{3,4}, {0,1}){7}[0xA-Fa-f0-9]{3,4}(}})$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
                    HttpRuntime.Cache["GuidFormat"] = instance;
                }
                return instance;
            }
        }

        /// <summary>
        /// Gets the country/region code format.
        /// </summary>
        /// <value>The country/region code format.</value>
        public static Regex CountryRegionCodeFormat
        {
            get
            {

                Regex instance = HttpRuntime.Cache["CountryRegionCodeFormat"] as Regex;
                if (instance == null)
                {
                    instance = new Regex(@"^[\w]{0,255}$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
                    HttpRuntime.Cache["CountryRegionCodeFormat"] = instance;
                }
                return instance;
            }
        }
        #endregion
    }
}
